﻿namespace ST.Simulator.Trans
{
    public class PortReqData
    {
    
        public ushort unitId { get; set; }
        public ushort functionCode { get; set; }

        public ushort StartAddress { get; set; }

        public ushort ReqNum { get; set; }

        public PortReqData(byte[] data)
        {
            // 解析事务标识符
             

            // 解析单元标识符
              unitId = data[0];

            // 解析功能码
              functionCode = data[1];
            if (data.Length >= 6)
            {
                StartAddress= (ushort)((data[2] << 8) | data[3]);
                ReqNum =   (ushort)((data[4] << 8) | data[5]);
            }
        }



    }
}
